Row

confirmed

1148

Active Cases

912

recovered

206

death

30

Row

Map

Daily cumulative cases

Row

Zipcode cases

Town cases

Row

Daily counts

---
title: COVID19 in Erie county
date: "`r gsub('\\(updated |\\ EST)|/2020', '', attributes(counts)$update.time)`"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    navbar:
      - { icon: fa-github, href: "https://github.com/hubentu/COVID19Erie"}
      - { title: "Erie Case Map", href: "https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1"}
      - { title: "Global Map", href: "https://coronavirus.jhu.edu/map.html"}
    social: menu
    source_code: embed
    vertical_layout: scroll
---

```{r setup, include=FALSE, eval=FALSE}
library(flexdashboard)
library(fontawesome)
library(COVID19Erie)
pubExposed <- exposedPub()
```

```{r, eval=FALSE}
Counts <- caseCounts()
counts <- Counts$counts
ctable1 <- rbind(counts,
                c(town = "Total", colSums(counts[,-1])))
ycount <- historyCount$confirmed[historyCount$date == Sys.Date() - 1]
ncount <- attributes(counts)$total.confirmed - ycount
```

Row {data-width=400}
-----------------------------------------------------------------------

### confirmed {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.confirmed,
  caption = paste0("Total confirmed cases (+", ncount, ")"),
  icon = "fas fa-ambulance",
  color = "purple"
)
```

### Active Cases {.value-box}
```{r}
valueBox(
  value = attributes(counts)$active.cases,
  caption = "Active cases",
  icon = "fas fa-hospital-user",
  color = "#1f77b4"
)
```

### recovered {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.recovered,
  caption = "Total recovered cases",
  icon = "fas fa-head-side-mask",
  color = "forestgreen"
)
```

### death {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.deaths,
  caption = "Death cases",
  icon = "fas fa-heart-broken",
  color = "#474747"
)
```


Row {data-height=600}
-----------------------------------------------------------------------
    
### Map
    
```{r}
caseMap(Counts, pubExposed, titlePos = NULL)
```

### Daily cumulative cases
```{r}
countPlot(historyCount)
```

Row
---------------------------------------------------------------------

### Zipcode cases
```{r}
library(DT)
datatable(Counts$zipCounts)
```

### Town cases

```{r}
## library(knitr)
## library(kableExtra)
## kable(ctable1,
##       caption = "COVID19 cases (Erie county)") %>%
##     kable_styling(full_width = TRUE) %>% 
##     footnote(general = c(paste("Last updated:", attributes(counts)$update.time),
##                          "[Data Source](https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1)",
##                          "[Public Advisories](http://www2.erie.gov/health/index.php?q=public-advisories)",
##                          "The data is only for educational and academic research purposes.")) %>%
## scroll_box(height = "600px")
datatable(ctable1[,1:2])
```

Row
----------------------------------------------------------------------

### Daily counts
```{r}
## kable(historyCount[order(historyCount$date, decreasing = TRUE),],
##       caption = "COVID19 Daily cases (Erie county)") %>%
##     kable_styling(full_width = TRUE)%>%
##     scroll_box(height = "600px")
datatable(historyCount[order(historyCount$date, decreasing = TRUE),])
```